package HomeWork.Work_02;

import java.util.Scanner;

/**
 * 定义一个任意的4位整数，求将该数反转以后的数，如原数为1234，反转后的数位4321。
 */
public class Number_06 {
    public static void main(String[] args) {
        number();
    }
    public static void number() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入任意4位整数");
        int number = sc.nextInt();
        int sum,num = 0;
        if(number > 9999) {
            System.out.println("输入出错！");
        }else{
            while(true){
                if(0 == number / 10){
                    sum = number;
                    num = num * 10 + sum;
                    break;
                }
                sum = number % 10;
                num = num * 10 + sum;
                number /= 10;
            }
            System.out.println(num);
        }
    }
}
